<template>
  <div class="my">

    <view class="my_content">
      
      <view @click='gotoNewPage'  class="my_yiyle">
        <uv-image  src="https://img.zcool.cn/community/01786557e4a6fa0000018c1bf080ca.png@1280w_1l_2o_100sh.png" width="115rpx" height="115rpx" shape="circle"></uv-image>
        <view>
        <view class="click">姜昊</view>
        <view class="click2">工号：123456</view>

      </view>
      </view>


      <view style="margin-top: 50rpx;" class="my_list ">
      <view style="margin-bottom: 20rpx;" class="list_title">
        <view class="list_left">
        <uv-image  src="/static/c1.png"   width="31rpx" height="28rpx" ></uv-image>
      <view class="my_text">我的信息</view>
    </view>
   
      </view>
      <uv-list >
	
        <uv-list-item 
   :customStyle="{fontSize:'22rpx'}"
		title="性别" 
		
		
		thumb-size="lg" 
		rightText="男">
	</uv-list-item>

  <uv-list-item 
   :customStyle="{fontSize:'22rpx'}"
		title="政治面貌" 
		
		
		thumb-size="lg" 
		rightText="党员">
	</uv-list-item>

  <uv-list-item 
   :customStyle="{fontSize:'22rpx'}"
		title="电话号码" 
		
		
		thumb-size="lg" 
		rightText="132016558945">
	</uv-list-item>

  <uv-list-item 
 
 title="身份证号" 

 
 thumb-size="lg" 
 rightText="610499811995566">
</uv-list-item>

<uv-list-item 
 
 title="参与项目" 

 
 thumb-size="lg" 
 rightText="陕西龙华集团煤业科技发展有限公司煤炭分级分质清洁高效综合利用项目">
</uv-list-item>
</uv-list>
   

      </view>


      <view style="margin-bottom: 200rpx;" class="my_list nopadding">
     

      <view class="box_list sa2">

        <view @click="gotoZHPage"  class="item wi">

          <uv-image src="/static/zhsz.png" width="50rpx" height="50rpx" ></uv-image>
          <view class="text">账户设置</view>
        </view>

       



<view @click="checkImage" class="item wi">

<uv-image src="/static/zzzs.png" width="50rpx" height="50rpx" ></uv-image>
<view class="text">资质证书</view>
</view>


<view @click="gotoIMAGE" style="position: relative;" class="item wi">

<uv-image src="/static/grxz.png" width="50rpx" height="50rpx"  ></uv-image>
<view  class="text">个人相册</view>

</view>


<view @click="gotoPD" class="item wi">

<uv-image src="/static/xmss.png" width="42rpx" height="55rpx" ></uv-image>
<view class="text">项目设置</view>
</view>



      </view>

      </view>


      
   <uv-button @click='outLogin'  shape="circle" type="primary">退出登录</uv-button>
    </view>


    



   
  </div>
</template>

<script setup>
import { onLoad, onShow } from '@dcloudio/uni-app';
import { ref } from 'vue';


let outLogin = () => {
  uni.clearStorageSync();
  uni.navigateTo({
    url:'/pages/login'
  })
}



let gotoZHPage = () => {
 uni.navigateTo({
   url:'/pages/setting'
 })

}



let gotoIMAGE = () => {
  uni.navigateTo({
    url:'/pages/myImage'
  })
}

 onShow(()=>{

 
 
 })


 let checkImage = () => {
  uni.previewImage({
				current: 0,
				urls: ['https://cdn.uviewui.com/uview/album/1.jpg']
	});
 }


 //登录临时凭证
 let code = ref(null)
 onLoad(()=>{

  uni.login({
    success: (res) => {
      console.log(res,'333')
      code.value = res.code
    
    },
  })

 })



 


let userInfo = ref({})
 let clickLogin = () => {
  uni.showLoading({
                    title: '登录中'
                })

uni.login({
    success: (res) => {
      console.log(res,'333')
      code.value = res.code
    
    },
  })

  uni.getUserProfile({
        desc: '登录后可同步数据',
        lang: 'zh_CN',
        success: (resInfo) => {
         console.log(resInfo,'2222')
         console.log(code.value,'31313')
          uni.request({
							url: 'https://test.xbike.run/mallApi/' + 'loginByWx',
							data: {
								code: code.value,
								share: ''
							},
							method: 'POST',
							header: {
								'content-type': 'application/json',
							},
							success: (res) => {
                console.log(res,'111')
								uni.hideLoading();
								if (res.statusCode == 200) {
								
									if (!res.data.fail) {
									let result = res.data.data
                                 
                                             
               const expiresTimeStamp = result.expiresIn * 1000 / 2 + new Date().getTime()
       // 缓存token的过期时间
        uni.setStorageSync('expiresTimeStamp', expiresTimeStamp)

        uni.setStorageSync('Token', result.accessToken) // 把token存入缓存，请求接口数据时要用
          uni.showToast({
            title: '登录成功',
            icon: 'none',
          
          })
          resInfo.userInfo.avatarUrl = 'https://img.zcool.cn/community/01786557e4a6fa0000018c1bf080ca.png@1280w_1l_2o_100sh.png'
          getApp().globalData.openId = result.openId;
          uni.setStorageSync('openId',result.openId)
          uni.setStorageSync('userInfo',JSON.stringify(resInfo.userInfo))
          uni.hideLoading()
          userInfo.value = resInfo.userInfo
          getuserInfo()
      getorderCountData()



          	// //openId、或SessionKdy存储//隐藏loading
            // getApp().globalData.sessionKey = res.data.result
						// 					.session_key;
						// 				getApp().globalData.openId = res.data.result
						// 					.openId;
						// 				//头像昵称获取状态
						// 				getApp().globalData.regstate = res.data.result
						// 					.regstate;
						// 				getApp().globalData.share = res.data.result.share;
						// 				console.log("openId: " + res.data.result.openId + " " + getApp().globalData.share);
	          //                                  //执行登录后的操作

									} else {
										uni.showToast({
											title: res.data.msg,
											icon: "none"
										});
									}
								} else {
                  uni.hideLoading();
									uni.showToast({
										title: "认证失败",
										icon: "none"
									})
								}

                uni.hideLoading();
							},
							fail: () => {
                uni.hideLoading();
							}
						});
          
          
          
  //  let result = {
  //       "accessToken": "357ae924-bf32-4edb-872d-69963fb0247d",
  //       "refreshToken": "357ae924-bf32-4edb-872d-69963fb0247d",
  //       "expiresIn": 2592000
  //   }


    
        },
      });
 }

</script>

<style lang="scss" scoped>

::v-deep .uv-list-item__extra{
 width: 55%;
}

::v-deep .uv-list-item__container{
  padding: 0!important;
}
::v-deep .uv-list-item__content-title{
  font-size: 24rpx!important;
}
::v-deep .uv-list-item{
  margin-bottom: 20rpx;
}
.list_goods{
  padding: 20rpx;
	.prive_title{
		margin-top: 8rpx;
		padding: 0 15rpx;
	}
	.shopmall{
    margin-top: 10rpx;
		display: flex;
  color: #8D8D8D;
  font-size: 22rpx;
  margin-bottom: 20rpx;
  padding: 0 15rpx;
	}
	.margin_top_bottom{
		padding: 0 15rpx;
		margin-bottom: 8rpx;
		margin-top: 6rpx;
		display: flex;
		align-items: center;
		flex-wrap: wrap;
		.box1{
			margin-right: 20rpx;
			border: 1px solid #FF1C23;
			width: 85rpx;
			height: 30rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			color: #DF0024;
			font-size: 18rpx;
		}
.box2{
	display: flex;
	align-items: center;
	margin-right: 20rpx;
}
	  .quan{
		padding: 1rpx;
		border: 1px solid #FF1C23;
		border-right: 1px dashed #FF1C23;
		color: #DF0024;
		font-size: 18rpx;
	  }
	  .quan2{
		padding: 1rpx;
		border: 1px solid #FF1C23;
		border-left: none;
		color: #DF0024;
		font-size: 18rpx;
	  }

	

	}
	.price_red{
		color: #FF1C23;
		font-size: 31rpx;
	}
	.price_scale{
		margin-left: 20rpx;
		color:#8D8D8D;
		font-size:22rpx;
	}
	margin-top: 70rpx;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	.item{
		margin-bottom: 20rpx;
		width: 49%;
     border-radius: 15rpx;
	 background: white;
	 .item_title{
		font-size: 25rpx;
		padding: 0 15rpx;
		margin-top: 15rpx;
		
		align-items: center;
	}
	.span_p{
		overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;  // 控制多行的行数
    -webkit-box-orient: vertical;


	}
	.nianhuo{
		display: inline-block;;
		border-radius: 10rpx;
		vertical-align: top;
		font-size: 20rpx;
		background-image: linear-gradient(135deg, rgb(246, 175, 175), red);
		width: 54rpx;
		height: 28rpx;
		text-align: center;
		color: white;
		font-weight: bolder;
		line-height: 28rpx;
       display: inline-block;
	}
	}
	
}
.nopadding{
  padding: 0!important;
}
.sa2{
  padding-bottom: 30rpx;
  flex-wrap: wrap;
}
.wi{
  display: flex;
  align-items: center;
  justify-content: center;
 margin-top: 30rpx;
  width: 25%;
}
.box_list{
  margin-top: 30rpx;
  margin-bottom: 20rpx;
  .item{
    display: flex;
    align-items: center;
    flex-direction: column;
    color: #333333FF;
    font-size: 22rpx;
    .text{
      margin-top: 10rpx;
    }
  }
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.my_text_right_lef{
  margin-right: 5rpx;
}
.list_title{
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.my_list{
  margin-bottom: 30rpx;
  border-radius: 30rpx;
  background: white;
  padding: 20rpx;
  padding-left: 30rpx;
  padding-right: 30rpx;
  .list_right{
    color: #4C4C4CFF;
    display: flex;
    align-items: center;
    font-size: 22rpx;
  }
  .list_left{
    display: flex;
    align-items: center;
    font-size: 24rpx;
    font-weight: bold;
    .my_text{
      margin-left: 10rpx;
    }

  }
}
.my_message{
  margin: 40rpx 0;
  padding: 0 20rpx;
  display: flex;
  align-items: center;
  justify-content: space-between;
  .item{
    display: flex;
    color: #4C4C4C;
    font-size: 22rpx;
    flex-direction: column;
    align-items: center;
    .tezxt{
      margin-top: 10rpx;
    }
  }
}
.my{
  min-height: 100vh;
  background: #F8F8F8;

}
.my_content{
  padding: 20rpx;
  background-image: linear-gradient(180deg, #9acafc, #F8F8F8);
  .click{
    font-size: 28rpx;
    font-weight: bold;
    margin-left: 20rpx;
  }
  .click2{
    font-size: 22rpx;
    margin-left: 20rpx;
    margin-top: 10rpx;
  }
 .my_yiyle{
  align-items: center;
  display: flex;
  
 }
}
</style>